package com.example.demo.client.vm.sysbasequery;

import com.example.demo.format.TreeFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Description:
 *
 * @Author zmf
 * @Date 2018/12/18  15:25
 */
@ApiModel("功能权限树")
public class PermissionTreeVm implements TreeFormat<PermissionTreeVm, Long>, Serializable{
    private static final long serialVersionUID = 4367425151775431279L;
    @ApiModelProperty("菜单ID")
    private Long menuId;
    @ApiModelProperty("菜单名称")
    private String nameCn;
    @ApiModelProperty("父菜单ID")
    private Long parentId;
    @ApiModelProperty("菜单类型")
    private String menuType;
    @ApiModelProperty("权限码")
    private String permissionCode;
    @ApiModelProperty("是否直接关联")
    private Integer directRelate = 0;
    @ApiModelProperty("是否选中")
    private boolean checked = false;
    @ApiModelProperty("选中状态，批量赋权使用到")
    private String checkedStatus = "0";
    @ApiModelProperty("子元素")
    private List<PermissionTreeVm> children;

    @Override
    public Long getId() {
        return menuId;
    }
    public Long getParentId() {
        return parentId;
    }

    @Override
    public void addChildren(PermissionTreeVm child) {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        this.children.add(child);
    }

    public Long getMenuId() {
        return menuId;
    }

    public void setMenuId(Long menuId) {
        this.menuId = menuId;
    }

    public String getNameCn() {
        return nameCn;
    }

    public void setNameCn(String nameCn) {
        this.nameCn = nameCn;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getMenuType() {
        return menuType;
    }

    public void setMenuType(String menuType) {
        this.menuType = menuType;
    }

    public String getPermissionCode() {
        return permissionCode;
    }

    public void setPermissionCode(String permissionCode) {
        this.permissionCode = permissionCode;
    }

    public Integer getDirectRelate() {
        return directRelate;
    }

    public void setDirectRelate(Integer directRelate) {
        this.directRelate = directRelate;
    }

    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }

    public String getCheckedStatus() {
        return checkedStatus;
    }

    public void setCheckedStatus(String checkedStatus) {
        this.checkedStatus = checkedStatus;
    }

    public List<PermissionTreeVm> getChildren() {
        return children;
    }

    public void setChildren(List<PermissionTreeVm> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "PermissionTreeVm{" +
            "menuId=" + menuId +
            ", nameCn='" + nameCn + '\'' +
            ", parentId=" + parentId +
            ", menuType=" + menuType +
            ", permissionCode='" + permissionCode + '\'' +
            ", directRelate=" + directRelate +
            ", checked=" + checked +
            ", checkedStatus='" + checkedStatus + '\'' +
            ", children=" + children +
            '}';
    }
}
